<?php
echo '<a href="/blog/create">写博客</a>';
foreach ($this->blogs as $blog){
    echo "<div class='blogSummary'>";
    echo "<h3><a href='/blog/view/id/".$blog['id']."'>".$blog['title']."</a></h3>";
    
    if (mb_strlen($blog['body']) > 400){
        echo mb_substr(strip_tags($blog['body'], "<p>"), 0, 400,'utf-8')."……"; // 滤掉<img>及html标签，只保留<p>
        echo "<span class='more_blog'><a href='/blog/detail/id/".$blog['id']."'>阅读全文>></a></span>";
    }
    else{
        echo strip_tags($blog['body'], "<p>");
    }
    echo "</div>";
}

if (count($this->blogs) > 1){
    echo $this->paginationControl($this->blogs,'Sliding','partials/pagination-control.phtml');
}
?>